import { findRegular,buyRegular,getCode} from '../../http/orders.js'
export default ({
	namespaced:true,
	state:{
		regularLists:[],
		inf:{
			regularId:0,
			regularTurnover:0,
			code:"11111",
			buyMode:"walletPay",
			isAutomaticRenewal:1,
			regularName:"",
			monthNum:12,
			
		},
	},
	mutations:{
		renderRegularId(state,data){
			state.regularLists=data;
		},
		// setInf(state,data){
		// 	const aa=state.regularLists.concat(data);
		// 	console.log(aa);
		// 	state.regularLists=aa;
		// },
		
	},
	actions:{
	async findRegularbyId(context,data){
			const result=await findRegular(data);
			console.log(result);
			if(result.code){
				context.commit("renderRegularId",result.data);
				console.log(result.data)
			}
			
		},

		// 定期购买
	async boughtRegular(context,data){
		// console.log(data);
		 return await buyRegular(data);
	},
	//  获取短信验证
	async getCode(state,data) {
		console.log(data,'data');
		return await getCode(data)
		 
		 }, 
	}
})